#include<iostream>
using namespace std;
int fibonacci1(int n)
{
    if (1==n||2==n)
    {
        return 1;
    }
    else
    {
        return fibonacci1(n-1)+fibonacci1(n-2);
    }  
}
int fibonacci2(int n)
{
    int f1=1;
    int f2=1;
    int f3=0;
    for (int i = 3; i <= n; i++)
    {
        f3=f1+f2;
        f1=f2;
        f2=f3;
    }
    return f3;
}
int main()
{
    int n=1000;
    //cout<<"fibonacci1计算结果:"<<fibonacci1(n)<<endl;
    cout<<"fibonacci2计算结果:"<<fibonacci2(n)<<endl;
}